package cn.talkimages.web.admin.actions.pic;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.talkimages.framework.utils.string.StringUtil;
import cn.talkimages.web.admin.constant.ConfkeyDef;
import cn.talkimages.web.beans.ImageBean;

public class PictureListAction extends PictureAction {

	private static final long serialVersionUID = -6416520199064843615L;

	/** 图片名称 */
	private String title;
	
	/** 图片编号 */
	private String imageNo;
	
	/** 图片原始编号 */
	private String originNo;

	private List<ImageBean> imageList;

	/**
	 * 显示图片一览
	 * 
	 * @throws Exception
	 */
	public String list() throws Exception {

		Map<String, Object> params = packageSearchParams();
		
		imageList = getImageService().getImageInfos(params, getPageNo(),
				getConfIntValue(ConfkeyDef.Pic.IMAGE_LIST_PAGESIZE));

		return SUCCESS;
	}
	
	private Map<String, Object> packageSearchParams() {
		
		Map<String, Object> params = new HashMap<String, Object>();
		
		params.put("title", title);
		params.put("imageNo", imageNo);
		params.put("originNo", originNo);
		
		return params;
	}

	// ----------------------- Getter & Setter ----------------------- //

	public List<ImageBean> getImageList() {
		return imageList;
	}

	public void setImageList(List<ImageBean> imageList) {
		this.imageList = imageList;
	}
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = StringUtil.trimToNull(title);
	}

	public String getImageNo() {
		return imageNo;
	}

	public void setImageNo(String imageNo) {
		this.imageNo = StringUtil.trimToNull(imageNo);
	}

	public String getOriginNo() {
		return originNo;
	}

	public void setOriginNo(String originNo) {
		this.originNo = originNo;
	}

}
